package cn.touna.jss.modules.custom.adress.enums;

import cn.touna.risk.api.domain.ResponseService;
import org.apache.commons.lang3.StringUtils;

/**
 * @Author:wuwc
 * @Description:
 * @Date:2018/3/2 11:52
 */
public enum AddressEnum implements ResponseService {
    ADDRESS_REPORT_NOTDATA("ADDRESS_DATA_NULL", "没有通讯录报告数据"),;

    private String errorCode;

    private String errorDesc;

    AddressEnum(String errorCode, String errorDesc) {
        this.errorCode = errorCode;
        this.errorDesc = errorDesc;
    }

    public static String getErrorDescByCode(String errorCode) {
        for (AddressEnum address : AddressEnum.values()) {
            if (StringUtils.equals(errorCode, address.getErrorCode())) {
                return address.getErrorDesc();
            }
        }
        return null;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorDesc() {
        return errorDesc;
    }

    public void setErrorDesc(String errorDesc) {
        this.errorDesc = errorDesc;
    }

    @Override
    public String getResponseCode() {
        return errorCode;
    }

    @Override
    public String getResponseMessage() {
        return errorDesc;
    }

    public static void main(String[] args) {
        System.out.println(getErrorDescByCode("1"));
    }

}
